<template>
  <div class="card-view">
    <el-card style="width: 100%">
      <template #header>
        <!-- <div w-full flex justify-between items-center> -->
        <div class="row">
          <div class="card-header">
            <div class="tip"></div>
            <div class="title">{{ props.title }}</div>
            <div v-if="props.showTime" class="time">
              更新时间 {{ getCurrTime() }}
            </div>
          </div>
          <div>
            <slot name="end"></slot>
          </div>
        </div>
      </template>
      <slot></slot>
    </el-card>
  </div>
</template>

<script setup>
const props = defineProps({
  title: {
    type: String,
    default: "",
  },
  timeShow: {
    type: Boolean,
    default: false,
  },
});
</script>

<style lang="scss" scoped>
.card-header {
  display: flex;
  align-items: center;
  .tip {
    width: 8px;
    height: 15px;
    background-color: #3d9cfb;
    margin-right: 10px;
  }
  .title {
    font-size: 15px;
    margin-right: 15px;
  }
  .time {
    font-size: 12px;
    color: #666;
  }
}
.row {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
</style>
